<!DOCTYPE html>
<html lang="zh">

<head>
	<th:block th:include="include :: header('项目成员')" />
	<link href="../static/layui/css/layui.css" th:href="@{/layui/css/layui.css}" rel="stylesheet" />
	<link href="../static/layui/css/dropdown.css" th:href="@{/layui/css/dropdown.css}" rel="stylesheet" />
	<link href="../static/css/projectDetail.css" th:href="@{/css/projectDetail.css}" rel="stylesheet" />
</head>

<body class="fixed-sidebar full-height-layout gray-bg">
	<!-- 头部导航 链接 -->
	<div class="row border-bottom white-bg dashboard-header headerNav">
		<div class="col-sm-1 logo">
			<div class="icon hidden-xs">
				<i class="fa fa-file-powerpoint-o"></i>
			</div>
			<div class="progressBar">
				<i>20.00%</i>
				<!-- style和 aria-valuenow里的数字代表进度 -->
				<div class="layui-progress" style="height: 5px;">
					<div class="layui-progress-bar " lay-percent="20.00%" style="width: 20%;"></div>
				</div>
			</div>
		</div>
		<div class="col-sm-11 navBar">
			<th:block th:include="include :: projectNavBar" />
		</div>
	</div>
	<!-- 主体部分 -->
	<div class="wrapper wrapper-content">
		<div class="btn-group-sm" id="toolbar" role="group">&nbsp;
<!--             <a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="gcgl:people:add"> -->
<!--                 <i class="fa fa-plus"></i> 添加 -->
<!--             </a> -->
<!--             <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="gcgl:people:edit"> -->
<!--                 <i class="fa fa-edit"></i> 修改 -->
<!--             </a> -->
<!--             <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="gcgl:people:remove"> -->
<!--                 <i class="fa fa-remove"></i> 删除 -->
<!--             </a> -->
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-tree-table"></table>
        </div>
	</div>
	<!-- import layui -->
	<th:block th:include="include :: footer" />
	<script th:src="@{/layui/dropdown.js?v=20250801}"></script>
	<th:block th:include="include :: projectDetail" />
	<!-- import layui -->
	<script th:inline="javascript">
		var editFlag = [[${@permission.hasPermi('gcgl:people:edit')}]];
	    var removeFlag = [[${@permission.hasPermi('gcgl:people:remove')}]];
	    var datas = [[${@dict.getType('sj_gzgw')}]];
	    var prefix = ctx + "sj/people";
	
	    $(function() {
	        var options = {
	            url: prefix + "/list/"+$("#id").val(),
	            createUrl: prefix + "/add/"+$("#id").val(),
	            updateUrl: prefix + "/edit/{id}",
	            removeUrl: prefix + "/remove",
	            modalName: "项目成员",
// 	            pagination: false,
		        showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                queryParams: queryParams,
//                 sortName: "id desc",
//                 sortOrder: "",
                code: "id",
		        parentCode: "pId",
		        uniqueId: "id",
		        expandAll: false,
		        expandFirst: false,
		        columns: [{
                    field: 'selectItem', 
                    radio: false
                },
                {
	                field: 'code',
	                title: '员工号'
	            },
	            {
	                field: 'id',
	                title: '主键',
	                visible: false
	            },
	            {
	                field: 'gcProjectid',
	                title: '合同ID',
	                visible: false
	            },
	            
	            {
	                field: 'name',
	                title: '姓名'
	            },
	            {
	                field: 'deptName',
	                title: '部门',
	                visible: false
	            },
	            {
	                field: 'ruleName',
	                title: '角色',
		            formatter: function(value, item, index) {
		            	return $.table.selectDictLabel(datas, item.ruleName);
		            }
	            },
	            {
	                field: 'pstartAt',
	                title: '计划开始日期',
	                visible: false
	            },
	            {
	                field: 'pendAt',
	                title: '计划完成日期',
	                visible: false
	            },
	            {
	                field: 'qz',
	                title: '权重'
	            },
	            {
	                field: 'yxgs',
	                title: '有效工时',
	                visible: false
	            },
	            {
	                field: 'jhgs',
	                title: '计划工时',
	                visible: false
	            },
	            {
	                field: 'sjgs',
	                title: '实际工时',
	                visible: false
	            },
	            {
	                title: '操作',
	                align: 'center',
	                formatter: function(value, row, index) {
	                    var actions = [];
	                    if(row.pId!=0){
	                    	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
	                    	actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
	                    }else{
	                    	actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="add4Cy(\'' + row.id + '\')"><i class="fa fa-edit"></i>添加成员</a> ');
// 	                    	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
// 	                    	actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
	                    }
	                    return actions.join('');
	                }
	            }]
	        };
	        $.treeTable.init(options);
	    });
	    
	    function add4Cy(id){
			$.modal.openTab('添加成员',"/sj/people/add4Cy/"+id);
	    }
	    
	    function queryParams(params){
        	var search = $.treeTable.queryParams(params);
        	search.gcProjectid = $("#id").val();
        	return search;
        }
    </script>
    <!--选中导航 这段js放在每个页面末尾-->
    <script>
		$(()=>{
			setTimeout(()=>{
				selectedNav(2)//第N个被选中 0即
			},100)
		})
		
		function selectedNav(index){
			$('ul.layui-nav').find('.layui-nav-item').eq(index).addClass('layui-this');
		}
	</script>
</body>
</html>